package Vista;
import Controlador.HandlerVentNuevoCurso;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import Controlador.Sistema;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentNuevoCurso extends javax.swing.JFrame {
	private JLabel lblMateria;
	private JTextField txtMateria;
	private JButton btnAceptar;
	private JButton btnCancelar;
	private JButton jButton1;
	private JTextField txtCantidad;
	private JTextField txtProfesor;
	private JLabel lblCantidad;
	private JLabel lblProfesor;
	public Sistema sistema = new Sistema();

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public VentNuevoCurso() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("NuevoCurso");
			getContentPane().setLayout(null);
			
			{
				lblMateria = new JLabel();
				getContentPane().add(lblMateria);
				lblMateria.setText("Materia: ");
				lblMateria.setBounds(79, 43, 112, 14);
			}
			{
				lblProfesor = new JLabel();
				getContentPane().add(lblProfesor);
				lblProfesor.setText("Profesor: ");
				lblProfesor.setBounds(79, 103, 112, 14);
			}
			{
				lblCantidad = new JLabel();
				getContentPane().add(lblCantidad);
				lblCantidad.setText("Cantidad Maxima: ");
				lblCantidad.setBounds(79, 164, 112, 14);
			}
			{
				txtMateria = new JTextField();
				getContentPane().add(txtMateria);
				txtMateria.setBounds(198, 36, 112, 21);
			}
			{
				txtProfesor = new JTextField();
				getContentPane().add(txtProfesor);
				txtProfesor.setBounds(197, 96, 112, 21);
			}
			{
				txtCantidad = new JTextField();
				getContentPane().add(txtCantidad);
				txtCantidad.setBounds(197, 157, 112, 21);
			}
			{
				btnAceptar = new JButton();
				getContentPane().add(btnAceptar);
				btnAceptar.setText("Aceptar");
				btnAceptar.setBounds(110, 204, 81, 21);
				btnAceptar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						//metodo del sistema
					}
				});
			}
			{
				btnCancelar = new JButton();
				getContentPane().add(btnCancelar);
				btnCancelar.setText("Cancelar");
				btnCancelar.setBounds(217, 204, 86, 21);
				btnCancelar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						dispose();
					}
				});
			}
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("Aceptar");
				jButton1.setBounds(110, 204, 81, 21);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						HandlerVentNuevoCurso h = new HandlerVentNuevoCurso();
						h.crearCurso(Integer.parseInt(txtProfesor.getText()), Integer.parseInt(txtMateria.getText()), Integer.parseInt(txtCantidad.getText()));
					}
				});
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
